package com.zrrd.yt.webll.controller;

import com.zrrd.yt.common.result.Result;
import com.zrrd.yt.product.client.ProductFeigClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
public class IndexController {

    @Autowired
    private ProductFeigClient productFeigClient;

    @GetMapping({"/","index.html"})
    public String index(HttpServletRequest request){
        //调用feign请求商品服务获取分类数据
        Result result = productFeigClient.getBaseCategoryList();
        //将分类数据存入到请求对象中
        request.setAttribute("list",result.getData());
        //跳转页面
        return "index/index";
    }

}
